﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using Shanfree.Framework.Utility;
using Shanfree.SharpMovie.BLL;
using Shanfree.SharpMovie.Model;

public partial class Movie_List : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                BindList();
            }
        }
        catch (Exception exc)
        {
            ShowMsg(exc.Message);
            LogEntry.Log.Write(exc.ToString(), EventLogEntryType.Error, LogSourceType.一般错误);
        }
    }

    #region 列表控件事件
    /// <summary>
    /// 翻页
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void pGrid_OnClick(object sender, EventArgs e)
    {
        try
        {
            BindList();
        }
        catch (Exception exc)
        {
            ShowMsg(exc.Message);
            LogEntry.Log.Write(exc.ToString(), EventLogEntryType.Error, LogSourceType.一般错误);
        }
    }

    private void BindList()
    {
        IList<MovieInfo> list = new Movie().GetList(gvMovie.PageSize, pGrid.CurrentPageIndex);
        gvMovie.DataSource = list;
        gvMovie.DataBind();
        CustomList<MovieInfo> cList = list as CustomList<MovieInfo>;
        if (null != cList)
        {
            pGrid.PageSize = gvMovie.PageSize;
            pGrid.TotalAmout = cList.TotalAmout;
        }
    }
    #endregion

}
